
//Tests
console.log("Regression test start");
/* Test 1 */
Page.addCtrl("testId");
Page.addCtrlFunct("testId", "testFunction", function(){ console.log("Test 1: Control adding and function calling. Success");});
Page.callCtrlFunct("testId", "testFunction");
/* Test 2 */
Page.addFunct("test", function(){
	console.log("Test 2: Content function calling. Success");
 });
Page.callFunct("test");
/* Test 3 */
var myTestObject = {"test 3": "tester"};
myTestObject["id"] = "testerObject";
Page.addObject(myTestObject);
var test3 = Page.getObject("testerObject");
Page.assert(test3, myTestObject, "Object Assertion Test.");
console.log("Test 3: Object adding. Success");
/* Test 4 */
var myTestFunction4 = function(args){
	console.log(args.message);
}
Page.addFunct("myTestFunction4", myTestFunction4);
Page.callFunct("myTestFunction4", {"message":"Test 4: Function argument passing. Success"});
/* Test 5 */
Page.assert(1,1, "Test assertion.");
console.log("Test 5: Basic assertion. Success");
/* Test 6 */
var myTestFunction6 = function(){
	return true;
}
Page.addFunct("myTestFunction6", myTestFunction6);
Page.assertFunctVal("myTestFunction6", true);
console.log("Test 6: Asserting boolean function values. Success");
/* Test 7 */
var myTestFunction7 = function(){
	return 1;
}

Page.addFunct("myTestFunction7", myTestFunction7);
Page.assertFunctVal("myTestFunction7", 1);
console.log("Test 7: Asserting integer function values. Success");
/* Test 8 */
var myTestFunction8 = function(){
	return 1;
}

Page.addCtrl("test8Ctrl");
Page.addCtrlFunct("test8Ctrl","myTestFunction8", myTestFunction8);
Page.assertCtrlFunctVal("test8Ctrl", "myTestFunction8", 1);
console.log("Test 8: Asserting ctrl function values. Success");
/* Test 9 */
var myTestFunction9 = function(addin){
	return 1+addin;
}

Page.addFunct("myTestFunction9", myTestFunction9);
Page.assertFunctVal("myTestFunction9", 2, 1);
console.log("Test 9: Asserting with arguments. Success");
/* Test 10 */
var instructs = [];
instructs.push({"id":"myTestFunction6", "expected":true});
instructs.push({"id":"myTestFunction7", "expected":1});
instructs.push({"id":"myTestFunction9", "expected":2, "args":1});
Page.assertAllFunctVal(instructs);
console.log("Test 10: Asserting in bulk. Success");
console.log("Regression test end");